import request from '@/utils/request'
import { praseStrEmpty } from "@/utils/ruoyi";




// 查询BTC矿池订单列表
export function orePoolList (query) {
  return request({
    url: '/investOrder/btc/list',
    method: 'get',
    params: query
  })
}

// 查询cru矿池订单列表
export function cruPackageList (query) {
  return request({
    url: '/investOrder/cru/list',
    method: 'get',
    params: query
  })
}

// 修改cru封装算力值
export function cruPackageUpdate (data) {
  return request({
    url: '/investOrder/cruPackage/update',
    method: 'post',
    data: data
  })
}

// 查询xch矿池订单列表
export function xchPackageList (query) {
  return request({
    url: '/investOrder/xch/list',
    method: 'get',
    params: query
  })
}

// 修改xch封装算力值
export function xchPackageUpdate (data) {
  return request({
    url: '/investOrder/xchPackage/update',
    method: 'post',
    data: data
  })
}

// 查询bzz矿池订单列表
export function bzzPackageList (query) {
  return request({
    url: '/investOrder/bzz/list',
    method: 'get',
    params: query
  })
}

// 修改bzz封装算力值
export function bzzPackageUpdate (data) {
  return request({
    url: '/investOrder/bzzPackage/update',
    method: 'post',
    data: data
  })
}

// 查询pha矿池订单列表
export function phaPackageList (query) {
  return request({
    url: '/investOrder/pha/list',
    method: 'get',
    params: query
  })
}

// 修改pha封装算力值
export function phaPackageUpdate (data) {
  return request({
    url: '/investOrder/phaPackage/update',
    method: 'post',
    data: data
  })
}

// 查询申请提现列表
export function cashList (query) {
  return request({
    url: '/applyWithdraw/list',
    method: 'get',
    params: query
  })
}

// 申请提现编辑提交
export function cashEdit (data) {
  return request({
    url: '/applyWithdraw/auditApply',
    method: 'post',
    data: data
  })
}

// 查询流水管理列表
export function transRecordList (query) {
  return request({
    url: '/transRecord/list',
    method: 'get',
    params: query
  })
}

// 查询用户资产列表
export function assetList (query) {
  return request({
    url: '/asset/list',
    method: 'get',
    params: query
  })
}

// 根据用户ID和币种查询资产信息
export function getAssetDetail (userId, currency) {
  return request({
    url: '/asset/getAssetDetail/' + praseStrEmpty(userId) + '/' + praseStrEmpty(currency),
    method: 'get'
  })
}

// 根据用户ID和币种查询BTC团队信息
export function getBtcUserTeamDetail (userId) {
  return request({
    url: '/appUser/getBtcUserTeamDetail/' + praseStrEmpty(userId),
    method: 'get'
  })
}

// 根据用户ID和币种查询CRU团队信息
export function getCruUserTeamDetail (userId) {
  return request({
    url: '/appUser/getCruUserTeamDetail/' + praseStrEmpty(userId),
    method: 'get'
  })
}

// 根据用户ID和币种查询XCH团队信息
export function getXchUserTeamDetail (userId) {
  return request({
    url: '/appUser/getXchUserTeamDetail/' + praseStrEmpty(userId),
    method: 'get'
  })
}

// 根据用户ID和币种查询BZZ团队信息
export function getBzzUserTeamDetail (userId) {
  return request({
    url: '/appUser/getBzzUserTeamDetail/' + praseStrEmpty(userId),
    method: 'get'
  })
}

// 根据用户ID和币种查询PHA团队信息
export function getPhaUserTeamDetail (userId) {
  return request({
    url: '/appUser/getPhaUserTeamDetail/' + praseStrEmpty(userId),
    method: 'get'
  })
}

// 内部兑换列表
export function exchangeList (query) {
  return request({
    url: '/transRecord/exchangeList',
    method: 'get',
    params: query
  })
}

// 内部转账列表
export function accountlist (query) {
  return request({
    url: '/transRecord/innerTransferList',
    method: 'get',
    params: query
  })
}

// 后台充币列表
export function charginglist (query) {
  return request({
    url: '/transRecord/directChargeList',
    method: 'get',
    params: query
  })
}

// 获取用户列表
export function appUserList (query) {
  return request({
    url: '/appUser/list',
    method: 'get',
    params: query
  })
}

// 获取系统参数列表
export function configList (query) {
  return request({
    url: '/config/list',
    method: 'get',
    params: query
  })
}

// 修改系统参数信息
export function updateConfig (data) {
  return request({
    url: '/config/update',
    method: 'post',
    data: data
  })
}

// 个人资产信息查询
export function selfQuery (userId, currency) {
  return request({
    url: '/asset/query/' + praseStrEmpty(userId) + '/' + praseStrEmpty(currency),
    method: 'get'
  })
}

// 监控指标查询
export function monitor (data) {
  return request({
    url: '/transRecord/monitor',
    method: 'get',
    data: data
  })
}

// 充值管理信息查询
export function chargeList (query) {
  return request({
    url: '/transRecord/depositList',
    method: 'get',
    params: query
  })
}

// 根据用户名模糊查询
export function fuzzyGetUser (query) {
  return request({
    url: '/appUser/searchUser',
    method: 'get',
    params: query
  })
}

// 用户树形表查询
export function queryUserTree (userId, currency) {
  return request({
    url: '/appUser/drawUserTree/' + praseStrEmpty(userId) + '/' + praseStrEmpty(currency),
    method: 'get'
  })
}

// 查询未读消息条数
export function getUnreadMsgCount () {
  return request({
    url: '/feedback/getUnreadMsgCount',
    method: 'get'
  })
}

// 清除未读消息条数
export function clearUnreadMsgCount () {
  return request({
    url: '/feedback/clearUnreadMsgCount',
    method: 'put'
  })
}


// 获取所有会话记录
export function getAllChat () {
  return request({
    url: '/feedback/getAllChat',
    method: 'get'
  })
}

// 获取单个会话的聊天记录
export function getAllChatFromUser (query) {
  return request({
    url: '/feedback/getAllChat/' + praseStrEmpty(query),
    method: 'get'
  })
}

// 获取单个会话的新消息
export function getNewMessage (query) {
  return request({
    url: '/feedback/getNewMessage/' + praseStrEmpty(query),
    method: 'get'
  })
}

// 发送文本信息
export function sendTextMsg (data) {
  return request({
    url: '/feedback/sendTextMsg/',
    method: 'get',
    params: {
      toUser: data.toUser,
      text: data.text
    }
  })
}

// 发送图片信息
export function sendImageMsg (data) {
  return request({
    url: '/feedback/sendImageMsg/',
    method: 'post',
    data: data
  })
}



// 锁定用户
export function lockUser (userId) {
  return request({
    url: '/appUser/lock/' + praseStrEmpty(userId),
    method: 'put'
  })
}

// 解锁用户
export function unLockUser (userId) {
  return request({
    url: '/appUser/unlock/' + praseStrEmpty(userId),
    method: 'put'
  })
}

// 设置用户团队信息
export function updateUserTeam (data) {
  return request({
    url: '/appUser/updateUserTeam',
    method: 'put',
    data: {
      userId: data.id,
      level: data.level,
      currency: data.currency,
      fixLevelFlag: data.fixLevelFlag,
      power: data.power,
      teamPowerFlag: data.teamPowerFlag ? data.teamPowerFlag : undefined
    }
  })
}

// 设置用户级别
export function updateLevel (data) {
  return request({
    url: '/appUser/updateLevel',
    method: 'put',
    data: {
      userId: data.id,
      level: data.level,
      currency: data.currency
    }
  })
}

// 设置用户算力
export function updatePower (data) {
  return request({
    url: '/appUser/updatePower',
    method: 'put',
    data: {
      userId: data.id,
      power: data.power,
      currency: data.currency
    }
  })
}

// 设置用户团队算力标识
export function updateTeamPowerFlag (data) {
  return request({
    url: '/appUser/updateTeamPowerFlag',
    method: 'put',
    data: {
      userId: data.id,
      teamPowerFlag: data.teamPowerFlag
    }
  })
}


// 修改用户登录密码/支付密码
export function updateAppUser (data) {
  return request({
    url: '/appUser/update',
    method: 'put',
    data: {
      id: data.id,
      password: data.password,
      payPassword: data.payPassword
    }
  })
}

// 后台直接充币操作
export function updateCharge (data) {
  return request({
    url: '/asset/directCharge',
    method: 'post',
    data: data
  })
}

// 获取产品信息列表
export function productList (query) {
  return request({
    url: '/product/list',
    method: 'get',
    params: query
  })
}

// 删除产品信息
export function productDelete (id) {
  return request({
    url: '/product/delete/' + id,
    method: 'delete'
  })
}

// 新增产品信息
export function productAdd (data) {
  return request({
    url: '/product/add',
    method: 'post',
    data: data
  })
}

// 修改产品信息
export function productUpdate (data) {
  return request({
    url: '/product/update',
    method: 'post',
    data: data
  })
}

// 上传产品图像  -- common公共方法
export function uploadFile (data) {
  return request({
    url: '/common/upload',
    method: 'post',
    data: data
  })
}

export function uploadImage (data) {
  return request({
    url: '/common/upload',
    method: 'post',
    data: data
  })
}

// 查询产品详细
export function getProduct (id) {
  return request({
    url: '/product/query/' + praseStrEmpty(id),
    method: 'get'
  })
}

// 查询矿池数据信息列表
export function poolDataList (query) {
  return request({
    url: '/appConfig/mineData/list',
    method: 'get',
    params: query
  })
}

// 新增矿池数据信息
export function poolDataAdd (data) {
  return request({
    url: '/appConfig/mineData/add',
    method: 'post',
    data: data
  })
}

// 获取banner信息列表
export function bannerList (query) {
  return request({
    url: '/appConfig/banner/list',
    method: 'get',
    params: query
  })
}

// 删除banner信息
export function bannerDelete (id) {
  return request({
    url: '/appConfig/banner/delete/' + id,
    method: 'delete'
  })
}

// 新增banner信息
export function bannerAdd (data) {
  return request({
    url: '/appConfig/banner/add',
    method: 'post',
    data: data
  })
}

// 查询banner详细
export function getBanner (id) {
  return request({
    url: '/appConfig/banner/query/' + praseStrEmpty(id),
    method: 'get'
  })
}

// 修改banner信息
export function bannerUpdate (data) {
  return request({
    url: '/appConfig/banner/update',
    method: 'post',
    data: data
  })
}

// 获取advertise信息列表
export function advertiseList (query) {
  return request({
    url: '/appConfig/advertise/list',
    method: 'get',
    params: query
  })
}

// 新增advertise信息
export function advertiseAdd (data) {
  return request({
    url: '/appConfig/advertise/add',
    method: 'post',
    data: data
  })
}

// 删除advertise信息
export function advertiseDelete (id) {
  return request({
    url: '/appConfig/advertise/delete/' + id,
    method: 'delete'
  })
}

// 查询advertise详细
export function getAdvertise (id) {
  return request({
    url: '/appConfig/advertise/query/' + praseStrEmpty(id),
    method: 'get'
  })
}

// 修改advertise信息
export function advertiseUpdate (data) {
  return request({
    url: '/appConfig/advertise/update',
    method: 'post',
    data: data
  })
}

// 获取version信息列表
export function versionList (query) {
  return request({
    url: '/appConfig/version/list',
    method: 'get',
    params: query
  })
}

// 新增version信息
export function versionAdd (data) {
  return request({
    url: '/appConfig/version/add',
    method: 'post',
    data: data
  })
}

// 删除version信息
export function versionDelete (id) {
  return request({
    url: '/appConfig/version/delete/' + id,
    method: 'delete'
  })
}

// 查询version详细
export function getVersion (id) {
  return request({
    url: '/appConfig/version/query/' + praseStrEmpty(id),
    method: 'get'
  })
}

// 修改version信息
export function versionUpdate (data) {
  return request({
    url: '/appConfig/version/update',
    method: 'post',
    data: data
  })
}

